
package com.castile.ows.dio.redis;

import org.apache.nifi.controller.ControllerService;

/**
 * 基于redis的分布式锁
 *
 * @author Hongliang Zhu
 * @create 2023-11-05 17:27
 */
public interface OwsRedisDistributedLock extends ControllerService {

    /**
     * 加锁
     *
     * @param key   Redis key
     * @param value Redis value
     * @param time  过期时间
     * @return true为加锁成功 false为加锁失败
     */
    boolean addLock(String key, String value, long time);

    /**
     * 释放锁
     *
     * @param key   Redis key
     * @param value Redis value
     * @return true为释放锁成功 false为释放锁失败
     */
    boolean releaseLock(String key, String value);
}
